-- require "preload"
-- ffi.cdef [[
--     typedef unsigned long DWORD;
--     typedef struct tagCOPYDATASTRUCT { 
--         intptr_t dwData; 
--         int cbData; 
--         int* lpData; 
--     } COPYDATASTRUCT; 
--     typedef const char* tstr;
--     int FindWindowA(tstr lpClassName,tstr lpWindowName);
--     int SendMessageA(int hwnd, int msg, void* wParam, void* lParam);
-- ]]

-- local hwnd = ffi.C.FindWindowA(nil, "aardio form")
-- local copyDataStruct = ffi.new("COPYDATASTRUCT")
-- local word = "getMessageFromLua"
-- copyDataStruct.dwData = 0
-- copyDataStruct.cbData = #word
-- copyDataStruct.lpData = ffi.cast("void*", word)
-- WM_COPYDATA = 0x004A
-- ffi.C.SendMessageA(hwnd, WM_COPYDATA, ffi.cast("void*", 0), ffi.cast("int*", copyDataStruct))

require "preload"
require "emmyLua64"
local mp = require "luajit-msgpack-pure"

local my_data = {this = {"is",4,"test"}}
local encoded = mp.pack(my_data)
local offset,decoded = mp.unpack(encoded)
print(#encoded,#[[{this = {"is",4,"test"}}]])
table.print(decoded)
